home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Sample Code / Devices / Load PCI Driver / SimpleApp / SimpleApp.h next >
Encoding:
C/C++ Source or Header  |  1997-07-10  |  20.9 KB  |  595 lines  |  [TEXT/CWIE]

  1. /*************************************************************************
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Simple App Framework
  5. **
  6. **    by Matthew Xavier Mora, Apple Developer Technical Support mxmora@apple.com
  7. **
  8. **    File:        SimpleApp.h
  9. **
  10. **    Copyright © 1995-1996 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. **
  21. **************************************************************************/
  22.  
  23. #include <Lists.h>
  24. #include <AppleEvents.h>
  25. #include <Drag.h>
  26. #ifndef __SIMPLEAPP__
  27. #define __SIMPLEAPP__
  28.  
  29. /*---------------------------------------------------------------------------------- */
  30. #pragma mark Defines
  31. /*---------------------------------------------------------------------------------- */
  32. #define    kMagicSig                 (0x4D584D21)    /* 'MXM!' our magic signature */
  33. #define    kMaxMenus                 (20)
  34. #define    kMaxMenuItems             (128)
  35. #define    kMaxButtons             (128)
  36. #define    kMaxEventProcs             (10)
  37. #define    kAppleEventLoadingErr     (129)
  38. #define kScrollBarType            'scrl'
  39. #define    kEventPassThru             (true)        /* This lets the event pass thru to the default handler */
  40. #define    kEventOverRide             (false)        /* This overides the event and doesn't call to the default handler */
  41.  
  42. #define    kUpArrow                 (30)
  43. #define    kDownArrow                 (31)
  44. #define    kEnterKey                 (0x03)
  45. #define    kReturnKey                 (0x0D)
  46. #define    kTabKey                 (0x09)
  47.  
  48. #define    kAppleNum                 (128)
  49. #define    kFileNum                 (129)
  50. #define    kEditNum                 (130)
  51. #define    kMenuStartID             (127)
  52. #define    kMargin                 (5)
  53. #define    kUseStandardMenu         (true)
  54.  
  55. #define    kErrorBase                ( 0 )     //    Base value for SimpleApp Error Numbers
  56. #define    kSAStandardDebugAlert     ( 9999)
  57. #define    kSANonFatalError         ( kErrorBase )
  58. #define    kSAFatalError             ( kErrorBase - 1 )
  59. #define    kSABadSelectorErr        ( kErrorBase - 2 )
  60. #define    kSABadProcPtr            ( kErrorBase - 3 )    
  61. #define    kNotOurWindowError         ( kErrorBase - 4 )    
  62. #define    kNotValidObject            ( kErrorBase - 5 )
  63.     
  64. #define    kSAInObject             (1)
  65. #define    kSANotInObject             (2)
  66. #define    kSAObjectWasHit         (3)
  67. #define    kSAObjectWasNotHit         (4)
  68.  
  69. #define kSANoCommandKey         ( 0 )    // value for no command key equivalent
  70.  
  71. #define kAboutText         (1)
  72. #define kButtonName     (2)
  73. #define kStaticStrings     (1000)
  74.  
  75. /*---------------------------------------------------------------------------------- */
  76. #pragma mark typedefs
  77. /*---------------------------------------------------------------------------------- */
  78. typedef            Str255 StringArray;
  79.  
  80. typedef            StringArray *StringArrayPtr,**StringArrayHandle ;
  81.  
  82. typedef            ControlRef ControlArray[];
  83. typedef            ControlArray *ControlArrayPtr,**ControlArrayHandle;        
  84.         
  85. typedef    struct    GroupRec             GroupRec,        *GroupRecPtr,        **GroupRecHandle;
  86. typedef    struct    ObjectItemRec         ObjectItemRec,    *ObjectItemRecPtr,    **ObjectItemRecHandle;
  87. typedef struct    MenuItemRec         MenuItemRec,    *MenuItemRecPtr ,    **MenuItemRecHandle ;
  88. typedef struct    ButtonItemRec         ButtonItemRec,    *ButtonItemRecPtr,    **ButtonItemRecHandle;
  89. typedef            ButtonItemRecHandle ButtonItemRef;
  90. typedef            ObjectItemRecHandle ObjectItemRef;
  91.  
  92. typedef pascal SInt16      (* MenuHitProc)      ( SInt32 modifiers);
  93. typedef pascal SInt16      (* MenuUpdateProc )    ( SInt32 modifiers);
  94. typedef pascal SInt16      (* ButtonHitProc)    ( ButtonItemRef me,SInt32 modifiers) ;
  95. typedef pascal SInt16      (* ButtonUpdateProc)( ButtonItemRef me,SInt32 modifiers);
  96. typedef pascal void       (* MyActionProc)    ( ControlHandle control,SInt16 part);
  97. typedef pascal Boolean     (* AboutProc)         ( SInt32 data);
  98.  
  99. typedef pascal Boolean     (* PreGroupHitProc)        (SInt32 modifiers ,Point pt, ControlArrayPtr cap , SInt16 count) ;
  100. typedef pascal SInt16     (* PostGroupHitProc)    ( SInt32 modifiers ,ControlRef cr,ButtonItemRecHandle brh, SInt16 item);
  101. typedef pascal SInt16     (* GroupUpdateProc)        ( WindowRef wind,GroupRecHandle grh );
  102.  
  103. typedef pascal SInt16     (*    WindowHitProc)        ( SInt32 modifiers);
  104. typedef pascal SInt16     (*    ListHitProc )        ( SInt32 modifiers) ;
  105. typedef pascal SInt16     (*    EditFieldHitProc)    ( SInt32 modifiers) ;
  106. typedef pascal SInt16     (*    WindowUpdateProc)    ( SInt32 modifiers) ;
  107. typedef pascal SInt16     (*    ListUpdateProc)        ( SInt32 modifiers) ;
  108. typedef pascal void         (*    ListDrawCellProc)    ( Point thecell, Rect *bounds ,ListRef listID );
  109. typedef pascal SInt16     (*    EditFieldUpdateProc)( SInt32 modifiers) ;
  110.  
  111. typedef pascal SInt16     (*    WindowIdleProc)        ( SInt32 modifiers ) ;
  112. typedef pascal SInt16     (*    ListIdleProc )        ( SInt32 modifiers ) ;
  113. typedef pascal SInt16     (*    EditFieldIdleProc)    ( SInt32 modifiers ) ;
  114. typedef pascal SInt16     (*    WindowGrowProc)        ( EventRecord *event );
  115. typedef pascal SInt16     (*    WindowZoomProc)        ( EventRecord *event );
  116. typedef pascal SInt16     (*    WindowActivateProc)    ( Boolean isActivating ) ;
  117.         
  118. typedef pascal SInt16     (*    TextFieldHitProc)    ( SInt32 modifiers) ;
  119. typedef pascal SInt16     (*    TextFieldUpdateProc)( SInt32 modifiers) ;
  120. typedef pascal SInt16     (*    EventProcs )        ( EventRecord *event) ;
  121. typedef pascal Boolean    (*    PreEventProc )         (EventRecord * event,long refCon);
  122. typedef pascal SInt16     (*    TerminateProc)        ( SInt32 flags) ;
  123. typedef pascal SInt16     (*    InitializeProc)        ( SInt32 flags) ;
  124. typedef pascal SInt16     (*    LowMemProc)            ( SInt32 flags ) ;
  125. typedef pascal SInt16     (*    MenuEventProc)        ( SInt32 menuResult);
  126. typedef pascal void         (*    WindowCloseProc)    ( WindowRef * theWindow);
  127.  
  128. /* generic object stuff */
  129. typedef pascal Handle    (* ObjectInitProc)        ( ObjectItemRecHandle orh);
  130. typedef pascal OSErr     (* ObjectDisposeProc)    ( ObjectItemRecHandle orh);
  131. typedef pascal SInt16     (* ObjectHitProc )         ( Point *pt,SInt32 modifiers, ObjectItemRecHandle me);
  132. typedef pascal SInt16     (* ObjectTrackProc )     ( Point *pt,SInt32 modifiers, ObjectItemRecHandle me);
  133. typedef pascal SInt16     (* ObjectUpdateProc)    ( WindowRef window, RgnHandle update,ObjectItemRecHandle me) ;
  134. typedef pascal void      (* ObjectKeyProc )        ( char keyCode, char theChar,SInt32 modifiers);
  135. typedef pascal void      (* ObjectIdleProc )        ( ObjectItemRecHandle orh);
  136. typedef pascal SInt16     (* ObjectEditProc )        ( ObjectItemRecHandle orh,SInt16 editAction);
  137.  
  138. typedef pascal SInt16     (*     GetDragDataProc)      (ObjectItemRef orh,OSType * theType,Ptr * data,long * len,long * flags);
  139. typedef pascal SInt16     (*     PutDragDataProc )      (ObjectItemRef orh,OSType theType,Ptr data,long len,long flags);
  140. typedef pascal SInt16     (*     CalcObjectRegionProc) (ObjectItemRef orh,RgnHandle theRgn);
  141. typedef pascal SInt16     (*     ObjectReceiveProc)      (ObjectItemRef orh,DragReference theDrag);
  142.  
  143. /* Apple Event Stuff */
  144. typedef pascal OSErr     (* OpenDocProc )     ( AppleEvent *ae, AppleEvent * AEreply,SInt32 handlerRefcon);
  145. typedef pascal OSErr     (* OpenAppProc )     ( AppleEvent *ae, AppleEvent * AEreply, SInt32 handlerRefcon);
  146. typedef pascal OSErr     (* QuitAppProc )     ( AppleEvent *ae, AppleEvent * AEreply, SInt32 handlerRefcon);
  147. typedef pascal OSErr     (* PrintDocProc )     ( AppleEvent *ae, AppleEvent * AEreply, SInt32 handlerRefcon);
  148. typedef pascal SInt16     (* ScriptProc )     ( SInt16 resId);
  149.  
  150. typedef pascal OSErr     (* OpenFileProc)     (FSSpecPtr myFSSPtr);
  151. typedef pascal OSErr     (*    NewDocProc )     (long refCon);
  152.  
  153. struct MenuItemRec {
  154.     SInt16             menuID  ;
  155.     SInt16             menuItem  ;
  156.     Handle             menuObject  ;
  157.     MenuHitProc     menuHit  ;
  158.     MenuUpdateProc     menuUpdate  ;
  159. };
  160.  
  161. struct    GroupRec {
  162.     long                 groupType;
  163.     GroupRecHandle         nextGroup;
  164.     short                 groupID;
  165.     WindowRef             window ;
  166.     Str255                 groupTitle;
  167.     long                  groupRefCon;
  168.     short                 groupControlCount; 
  169.     StringArrayPtr         groupControlnames; 
  170.     Rect                 groupBounds ; 
  171.     short                 groupHSpacing;
  172.     short                 groupVSpacing ;
  173.     short                 groupFlags;
  174.     PreGroupHitProc     groupPreHit ; 
  175.     PostGroupHitProc     groupPostHit ; 
  176.     GroupUpdateProc     groupUpdate ;
  177.     ControlArrayPtr     groupControlArray;
  178. };
  179.             
  180. struct ButtonItemRec {
  181.     long                buttonType;
  182.     ButtonItemRef        nextButton  ;
  183.     SInt16                 buttonID  ;
  184.     ControlRef             buttonObject  ;
  185.     long                buttonRefCon;
  186.     GroupRecHandle        buttonGroup;
  187.     ButtonHitProc         buttonHit  ;
  188.     ButtonUpdateProc    buttonUpdate  ;
  189. };
  190.  
  191. struct ObjectItemRec {
  192.     long                objectType;
  193.     ObjectItemRef        nextObject;
  194.     SInt16                objectID;
  195.     Handle                objectHandle;
  196.     Str255                objectName;
  197.     Rect                objectRect;
  198.     UInt8                objectCmdKey;
  199.     WindowRef            objectOwner;
  200.     GroupRecHandle        objectGroup;
  201.     ObjectInitProc        objectInit;
  202.     ObjectDisposeProc    objectDispose;
  203.     ObjectHitProc        objectHit;
  204.     ObjectHitProc        objectTrack;
  205.     ObjectUpdateProc    objectUpdate;
  206.     ObjectIdleProc        objectIdle;
  207.     ObjectKeyProc        objectKey;
  208.     ObjectEditProc        objectEdit;
  209.     UInt32                objectRefCon;
  210.     UInt32                objectFlags;
  211.     SInt16                objectState;
  212. };
  213.  
  214. /*
  215.  
  216.                 buttonType:longint; 
  217.                 nextButton: ButtonItemRecHandle;
  218.                 buttonID: integer;
  219.                 buttonObject: ControlHandle;
  220.                 buttonRefCon    : longint;
  221.                 buttonGroup:GroupRecHandle;
  222.                 buttonHit: ButtonHitProc;
  223.                 buttonUpdate: ButtonUpdateProc;
  224.                 
  225.                 
  226. */
  227.  
  228. typedef struct     ScrollItemRec ScrollItemRec,*ScrollItemRecPtr, **ScrollItemRecHandle;    
  229.                 
  230. struct        ScrollItemRec {
  231.     SInt32 scrollType;
  232.     ScrollItemRecHandle nextScroll;
  233.     SInt16 scrollID;
  234.     ControlHandle scrollObject;
  235.     MyActionProc scrollHit;
  236.     MyActionProc scrollUpdate;
  237.     MyActionProc scrollIndicator;
  238.     MyActionProc scrollButton;
  239. };
  240.  
  241. struct PrintAreaRec {
  242.         Rect windowPrintRect  ;
  243.         SInt16 windowPrintHorz  ;
  244.         SInt16 windowPrintVert  ;
  245.         SInt16 windowPrintLineHeight  ;
  246.         SInt16 windowPrintMaxVert  ;
  247.         SInt16 windowPrintMargin  ;
  248. };
  249. typedef struct PrintAreaRec PrintAreaRec ,* PrintAreaRecPtr,**PrintAreaRecHandle;
  250.  
  251. typedef struct    ListItemRec ListItemRec,*ListItemRecPtr,**ListItemRecHandle ;
  252.  
  253. struct    ListItemRec {
  254.     ListItemRecHandle nextList  ;
  255.     ListRef listObject  ;
  256.     SInt16 listID  ;
  257.     ListHitProc listHit  ;
  258.     ListUpdateProc listUpdate  ;
  259.     ListIdleProc listIdle  ;
  260. };
  261.  
  262. typedef struct    EditFieldItemRec EditFieldItemRec,*EditFieldItemRecPtr,**EditFieldItemRecHandle ;
  263.  
  264. struct EditFieldItemRec {
  265.     EditFieldItemRecHandle nextEdit  ;
  266.     SInt16 editFieldID  ;
  267.     SInt32 editFieldFlags ;
  268.     TEHandle editFieldObject  ;
  269.     EditFieldHitProc editFieldHit  ;
  270.     EditFieldUpdateProc editFieldUpdate  ;
  271.     EditFieldIdleProc editFieldIdle  ;
  272. }; 
  273.  
  274.  
  275. enum { 
  276.         EditType,
  277.         ListType,
  278.           ButtonType
  279. } ;
  280. typedef SInt8 contentItemType;
  281.         
  282. struct    ContentRec {
  283.     SInt16 contentCount  ;
  284.     contentItemType kind  ;
  285.     union {
  286.         EditFieldItemRec efr  ;
  287.         ListItemRec lir  ;
  288.         ButtonItemRec bir ;         
  289.     };
  290. };
  291.  
  292. typedef struct     ContentRec ContentRec,*    ContentRecPtr;
  293.         
  294. typedef ContentRec WindowItemsArray[];
  295. typedef ContentRec * WindowItemsArrayPtr;
  296.  
  297. struct WindowItemRec {
  298.         SInt32                     windowMagic  ; /* Signature so we know our windows */
  299.         SInt16                     windowID  ;
  300.         WindowRef                 windowObject  ;
  301.         WindowHitProc             windowHit  ;
  302.         WindowUpdateProc         windowUpdate  ;
  303.         WindowIdleProc             windowIdle  ;
  304.         WindowGrowProc             windowGrow  ;
  305.         WindowActivateProc         windowActivate  ;
  306.         WindowCloseProc            windowClose;
  307.         WindowZoomProc            windowZoom;
  308.         PrintAreaRec             windowPrintAreaRec  ;
  309.         FSSpec                     windowFSSpec  ;
  310.         SInt16                   windowRefNum;
  311.         ListItemRecHandle         windowLists  ;
  312.         EditFieldItemRecHandle     windowEdits  ;
  313.         ButtonItemRecHandle     windowButtons  ;
  314.         ScrollItemRecHandle     windowScroll;
  315.         Boolean                 windowHasControls  ;
  316.         Boolean                 windowHasLists  ;
  317.         Boolean                 windowHasEditField  ;
  318.         SInt16                     windowItemCount  ;
  319.         WindowItemsArrayPtr     windowItems  ;
  320. };
  321. typedef struct WindowItemRec WindowItemRec, *WindowItemRecPtr,**WindowItemRecHandle;
  322.  
  323.         
  324. struct ProcTableRec {
  325.     EventProcs         EventProcsArray[kMaxEventProcs];
  326.     TerminateProc     Terminate ;
  327.     InitializeProc     Initialize;
  328.     LowMemProc         LowMem ;
  329.     MenuEventProc     MenuEvent ;
  330.     AboutProc         About;
  331.     OpenFileProc    openFile;
  332.     OpenDocProc     openDocAE ;
  333.     OpenAppProc     openAppAE;
  334.     QuitAppProc     quitAppAE;
  335.     PrintDocProc     printDocAE;
  336.     NewDocProc       newDoc;
  337. };
  338.  
  339.  
  340. #if __POWERPC__
  341. // they are in the TOC
  342. #else
  343. #define gSACurrentWindow     GSACURRENTWINDOW
  344. #define gSACurControl         GSACURCONTROL
  345. #define gSAVPageSize         GSAVPAGESIZE
  346. #define gSAHPageSize         GSAHPAGESIZE
  347. #define gSAVLineSize         GSAVLINESIZE
  348. #define gSAHLineSize        GSAHLINESIZE
  349. #define gSAEvent             GSAEVENT
  350. #define gSAProcs            GSAPROCS
  351. #define gSAMac                GSAMAC
  352. #define gSAIsInBackground   GSAISINBACKGROUND
  353. #endif
  354.  
  355.  
  356. typedef struct ProcTableRec ProcTableRec, *ProcTablePtr;
  357. /*---------------------------------------------------------------------------------- */
  358. #pragma mark Globals
  359. /*---------------------------------------------------------------------------------- */
  360. extern    ListRef         gSAMyList  ;
  361. extern    SInt16             gSATerminateReason ;     /* When Quiting this tells us why we are quiting */
  362. extern    Boolean         gSADebug ;            /* Activate Debug Alerts. May make this an SInt16 */
  363.                                         /* for levels of debug */
  364. extern    ProcTableRec    gSAProcs  ;
  365. extern    Boolean         gOApped  ;
  366. extern    Boolean         gSADone  ;
  367. extern    Boolean         gSAHasAppleEvents  ;
  368. extern    Boolean         gSAHasTE  ;
  369. extern    Boolean         gSAHasList  ;
  370. extern    MenuRef         gSAAppleMenu  ;
  371. extern    MenuRef         gSAFileMenu  ;
  372. extern    MenuRef         gSAEditMenu  ;
  373. extern    EventRecord     gSAEvent  ;
  374. extern    Boolean         gSAHasControls  ;
  375. extern    WindowRef         gSACurrentWindow  ;
  376. extern    SInt16             gSADefaultFont  ;
  377. extern    SInt16             gsADefaultSize  ;
  378. extern    SysEnvRec         gSAMac  ;
  379. extern    WindowItemRecHandle gSACurWRecHandle  ;
  380. extern    SInt16             gSAWindowID  ;
  381. extern    TEHandle         gSACurTE  ;
  382. extern     ControlHandle     gSACurControl;
  383. extern    ListRef         gSACurList  ;
  384. extern     SInt16             gSACurrentItem;
  385. extern     Boolean            gSAIsInBackground;
  386.  
  387. /*---------------------------------------------------------------------------------- */
  388. #pragma mark Prototypes
  389. /*---------------------------------------------------------------------------------- */
  390.  
  391. pascal    SInt16    SAExecuteScript(SInt16 resID);
  392. pascal    void    SAMoveObject (ObjectItemRecHandle orh,SInt16 h,SInt16 v, Boolean reDraw);
  393. pascal    void    SADrawGroup(GroupRecHandle    grh,RgnHandle update);
  394.  
  395. pascal    void    InitSimpleApp (SInt16 masters ,  Boolean wantsStandardMenu);
  396. pascal    void    Run(void);
  397. pascal    void    CloseSimpleApp(void);
  398. pascal  void    SADoWindowClose(WindowRef * theWindow);
  399.  
  400. pascal    SInt16 DefaultMenuHit ( SInt32 modifiers);
  401.  
  402. pascal    SInt16 InstallFontMenu(SInt16 menuID,
  403.                                ConstStr255Param name,
  404.                               MenuHitProc menuHit,
  405.                               MenuUpdateProc menuUpdate);
  406.  
  407. pascal    SInt16 InstallMenu (SInt16 menuID,
  408.                             ConstStr255Param menuTitle,
  409.                             Boolean    Hierarchical,
  410.                             MenuHitProc    menuHit,
  411.                             MenuUpdateProc    menuUpdate );
  412.                                 
  413. pascal    SInt16 InstallResourceMenu (SInt16 menuID,
  414.                                     ConstStr255Param menuTitle,
  415.                                     OSType    resourceType,
  416.                                     SInt16    afterItem,
  417.                                     MenuHitProc    menuHit,
  418.                                     MenuUpdateProc    menuUpdate);
  419.  
  420. pascal    SInt16 InstallMenuItem (SInt16 menuID, 
  421.                                 SInt16 MenuItem,
  422.                                 ConstStr255Param menuTitle, 
  423.                                 UInt8 mark,
  424.                                 UInt8 cmdChar,
  425.                                 MenuHitProc menuHit,
  426.                                 MenuUpdateProc menuUpdate);
  427.  
  428. pascal    SInt16 InstallPushButton (SInt32 *buttonID,
  429.                                  WindowRef window,
  430.                                  ConstStr255Param name,
  431.                                  Rect *r,
  432.                                  UInt8 cmdKey,
  433.                                  ButtonHitProc bhp ,
  434.                                  ButtonUpdateProc bup  );
  435.                                  
  436. pascal     SInt16 InstallCustomObject (SInt32 * objectID,
  437.                                     WindowRef window ,
  438.                                     ConstStr255Param name ,
  439.                                     Rect * r ,
  440.                                     UInt8 cmdKey ,
  441.                                     ObjectInitProc oip ,
  442.                                     ObjectDisposeProc odp ,
  443.                                     ObjectHitProc ohp ,
  444.                                     ObjectTrackProc otp ,
  445.                                     ObjectUpdateProc oup ,
  446.                                     long refCon);
  447.                                     
  448. pascal SInt16 InstallControl (SInt32 * buttonID,
  449.                              WindowRef window,
  450.                              ConstStr255Param name,
  451.                              Rect *  r ,
  452.                              UInt8 cmdKey,
  453.                              SInt16 controlType,
  454.                              ButtonHitProc bhp ,
  455.                              ButtonUpdateProc bup );
  456.                              
  457. pascal SInt16 InstallCheckBox (SInt32 *buttonID,
  458.                              WindowRef window,
  459.                              ConstStr255Param name,
  460.                              Rect *  r ,
  461.                              UInt8 cmdKey,
  462.                              SInt16 initialValue, 
  463.                              ButtonHitProc bhp ,  /* set to nil for default checkbox action */
  464.                              ButtonUpdateProc bup );
  465.                              
  466. pascal    SInt16 InstallScrollBar (SInt32 * buttonID,
  467.                                  WindowRef window,
  468.                                  ConstStr255Param name,
  469.                                  Rect *r,
  470.                                  UInt8 cmdKey,
  471.                                  MyActionProc scrollHitProc ,
  472.                                  MyActionProc scrollButtonProc ,
  473.                                  MyActionProc  scrollIndicatorProc);
  474. pascal SInt16 InstallPopUp (long    *theButtonID,
  475.                             WindowRef window,
  476.                             ConstStr255Param name,
  477.                             Rect * r,
  478.                             SInt16 options,
  479.                             SInt16 styles,
  480.                             SInt16 MenuID,
  481.                             OSType resID,
  482.                             ButtonHitProc bhp, 
  483.                             ButtonUpdateProc bup 
  484.                             );                                 
  485. pascal SInt16 InstallRadioGroup (SInt16 theGroupID,
  486.                                 WindowRef window, 
  487.                                 SInt16 count, 
  488.                                 ConstStr255Param title,
  489.                                 StringArrayPtr names,
  490.                                 Rect * r, 
  491.                                 SInt16 defaultItem,
  492.                                 SInt16 hSpacing,
  493.                                 SInt16 vSpacing,
  494.                                 SInt16 buttonHeight,
  495.                                 SInt16 buttonWidth,
  496.                                 PreGroupHitProc PreGHP, 
  497.                                 PostGroupHitProc PostGHP, 
  498.                                 GroupUpdateProc gup );
  499.  
  500. pascal    SInt16 CreateDocumentWindow (ConstStr255Param name  ,
  501.                                     Rect * bounds  ,
  502.                                     Boolean visable );
  503. pascal void SAInitScripting(void);    
  504.                                 
  505. pascal    SInt16 GetDocumentWindow (  SInt16 resID);
  506.  
  507. pascal    void Print (Str255 s );                   /* Print no CR */
  508. pascal    void PrintLine (Str255 s);                /* Print with CR */
  509. pascal    void PrintTextHandle (Handle text  );     /* Print a buffer full of text with CR */
  510.  
  511. pascal    void SetRectLocation ( Rect *r,SInt16 h, SInt16 v);            /* This Sets a rects anchor point */
  512. pascal    void SetRectDimensions (Rect *r,SInt16 h, SInt16 v);            /* This Sets its size without changing its position */
  513.  
  514. pascal    void GetPrintArea (WindowRef window ,Rect * bounds );
  515. pascal    void SetPrintArea (WindowRef window, Rect * bounds );
  516.  
  517. pascal    EditFieldItemRecHandle SAGetEditField (WindowRef wind,SInt16 editID) ;
  518. pascal    void     SASetFocus (WindowRef theWindow, EditFieldItemRecHandle efrh);
  519. pascal    SInt16    AttachMenuToItem(SInt16 menuIDToAdd,SInt16 AttachMenuID,SInt16 AttachItem);
  520.  
  521. pascal    SInt16 InstallEditField (SInt32 * editID , 
  522.                                 WindowRef window,
  523.                                 ConstStr255Param name  ,
  524.                                 Rect * r,
  525.                                 EditFieldHitProc hitProc  ,
  526.                                 EditFieldUpdateProc updateProc  ,
  527.                                 ObjectKeyProc    keyProc    ,
  528.                                 SInt32 flags  );
  529.  
  530. pascal    SInt16 InstallList (SInt32 * listID  , 
  531.                             WindowRef window,
  532.                             Rect * r,
  533.                             ListHitProc lhp  , 
  534.                             ListUpdateProc lup  ,
  535.                             ListDrawCellProc ldcp  , 
  536.                             SInt32 flags );
  537.                             
  538. pascal SInt16     InstallPopUp(SInt32 *buttonID,
  539.                              WindowRef window,
  540.                              ConstStr255Param name,
  541.                              Rect *r,
  542.                              SInt16 options,
  543.                              SInt16 styles,
  544.                              SInt16 MenuID,
  545.                              OSType resID,
  546.                              ButtonHitProc bhp,
  547.                              ButtonHitProc bup);
  548.  
  549. pascal    SInt16 GetTEString (SInt16 editFieldID  ,ConstStr255Param s  ) ;
  550. pascal    OSErr AddStringToList (ListRef listID  ,ConstStr255Param s  );
  551.  
  552. pascal    void BlastString (SInt16 h, SInt16 v  ,Str255 s  ); /* These will blast text at the location specified. It erases as it draws */
  553. pascal    void BlastText (SInt16 h,SInt16 v  ,Handle text  );
  554. pascal    void InstallIdleProc(EventProcs  ip);
  555. pascal  void SetMyTitle(Str255 title);
  556. pascal  void SAEnableMe(void);
  557. pascal  void SADisableMe(void);
  558. pascal  void SAEnableObject(SInt32 thing);
  559. pascal  void SADisableObject(SInt32 thing);
  560. pascal  void SADisableMe();
  561. pascal     ButtonItemRecHandle SAGetGroupItem(WindowRef wind,SInt16 groupID,SInt16 item);
  562. pascal    SInt16 SADrawObject(ObjectItemRecHandle orh,RgnHandle update);
  563. pascal     SInt16 InstallStaticText(SInt32 * textID,WindowRef window,ConstStr255Param s ,Rect *r);
  564. pascal  void  ErrorMessage(ConstStr255Param msg,SInt32 error,SInt16 flags);
  565.  
  566. pascal    Handle SAGetObjectHandle(long thing);
  567.  
  568. pascal  void   SetWindowHitProc     (WindowRef window,WindowHitProc     theProc );
  569. pascal  void   SetWindowUpdateProc    (WindowRef window,WindowUpdateProc     theProc );
  570. pascal  void   SetWindowIdleProc    (WindowRef window,WindowIdleProc     theProc );
  571. pascal  void   SetWindowGrowProc    (WindowRef window,WindowGrowProc     theProc );
  572. pascal  void   SetWindowActivateProc(WindowRef window,WindowActivateProc theProc );
  573. pascal  void   SetWindowCloseProc     (WindowRef window,WindowCloseProc     theProc );
  574. pascal  void   SetWindowZoomProc     (WindowRef window,WindowZoomProc     theProc );
  575. pascal  void   SetWindowFSSpec         (WindowRef window,FSSpecPtr   FSSpec);
  576.  
  577. pascal     OSErr  GetWindowFSSpec         (WindowRef window,FSSpecPtr  theFSSpec );
  578. pascal    WindowCloseProc  GetWindowCloseProc (WindowRef window);
  579. pascal     void      SelectFile(void);
  580. pascal     void     SetOpenFileProc (OpenFileProc openFile);
  581. pascal  void InstallPreEventHandler (PreEventProc eventHandler,long refCon);
  582. pascal short SASetSleepValue(short sleep);
  583.  
  584. // drag stuff
  585.  
  586. pascal OSErr SADoWindowContentDrag (WindowPtr theWindow, EventRecord *theEvent);
  587. pascal OSErr SAInstallDragHandlers (WindowPtr theWindow,DragTrackingHandler track,DragReceiveHandler receive);
  588. pascal OSErr SAInstallStandardDragHandlers (WindowPtr theWindow);
  589. pascal OSErr SAAddDataType(WindowPtr theWindow,OSType theType);
  590. pascal OSErr SAAddWindowDragDataTypes(WindowPtr theWindow,OSType theType);
  591.     
  592. pascal OSErr InstallDragObject(long * ObjectID,WindowRef window,ConstStr255Param name,Rect * r,GetDragDataProc gdp,PutDragDataProc pdp,ObjectReceiveProc orp, long refCon);
  593.  
  594. #endif    
  595.